-
NavigationViewController
is a fully-featured user interface for turn-by-turn navigation. Do not confuse it with theNavigationController
class in UIKit.You initialize a navigation view controller based on a predefined
RouteResponse
andNavigationOptions
. As the user progresses along the route, the navigation view controller shows their surroundings and the route line on a map. Banners above and below the map display key information pertaining to the route. A list of steps and a feedback mechanism are accessible via the navigation view controller.Route initialization should be configured before view controller’s
view
is loaded. Usually, that is automatically done during any of theinit
s, but you may also change this settings viaprepareViewLoading(routeResponse:, routeIndex:, routeOptions:, navigationOptions:)
methods. For example that could be handy while configuring a ViewController for aUIStoryboardSegue
.To be informed of significant events and decision points as the user progresses along the route, set the
NavigationService.delegate
property of theNavigationService
that you provide when creating the navigation options.CarPlayNavigationViewController
manages the corresponding user interface on a CarPlay screen.Important
Creating an instance of this type with parameters that usesRouteController
with will start an Active Guidance session. The trip session is stopped when the instance is deallocated. For more info read the Pricing Guide.Declaration
Swift
open class NavigationViewController : UIViewController, NavigationStatusPresenter, NavigationViewData, BuildingHighlighting
extension NavigationViewController: NavigationMapViewDelegate
extension NavigationViewController: NavigationServiceDelegate
extension NavigationViewController: StyleManagerDelegate
extension NavigationViewController: TopBannerViewControllerDelegate
extension NavigationViewController: BottomBannerViewControllerDelegate
extension NavigationViewController: CarPlayConnectionObserver
-
The
NavigationViewControllerDelegate
protocol provides methods for configuring the map view shown by aNavigationViewController
and responding to the cancellation of a navigation session.For convenience, several location-related methods in the
See moreNavigationServiceDelegate
protocol have corresponding methods in this protocol.Declaration
Swift
public protocol NavigationViewControllerDelegate : VisualInstructionDelegate
-
A route voice controller monitors turn-by-turn navigation events and triggers playing spoken instructions as audio using the instance of
SpeechSynthesizing
type.You initialize a voice controller using a
NavigationService
instance. The voice controller observes when the navigation service hints that the user has passed a spoken instruction point and responds by calling it’sspeechSynthesizer
to handle the vocalization.If you want to use your own custom
SpeechSynthesizing
implementation - also pass it during initialization. If no implementation is provided -MultiplexedSpeechSynthesizer
will be used by default.You can also subclass
See moreRouteVoiceController
to implement you own mechanism of monitoring navgiation events and callingspeechSynthesizer
.Declaration
Swift
open class RouteVoiceController : NSObject, AVSpeechSynthesizerDelegate
extension RouteVoiceController: AVAudioPlayerDelegate
-
Protocol for implementing speech synthesizer to be used in
See moreRouteVoiceController
.Declaration
Swift
public protocol SpeechSynthesizing : AnyObject
-
The
See moreSpeechSynthesizingDelegate
protocol defines methods that allow an object to respond to significant events related to spoken instructions.Declaration
Swift
public protocol SpeechSynthesizingDelegate : AnyObject, UnimplementedLogging
-
See moreSpeechSynthesizing
implementation, usingMapboxSpeech
framework. Uses pre-caching mechanism for upcoming instructions.Declaration
Swift
open class MapboxSpeechSynthesizer : NSObject, SpeechSynthesizing
extension MapboxSpeechSynthesizer: AVAudioPlayerDelegate
-
See moreSpeechSynthesizing
implementation, usingAVSpeechSynthesizer
.Declaration
Swift
open class SystemSpeechSynthesizer : NSObject, SpeechSynthesizing
extension SystemSpeechSynthesizer: AVSpeechSynthesizerDelegate
-
See moreSpeechSynthesizing
implementation, aggregating other implementations, to allow ‘fallback’ mechanism. Can be initialized with array of synthesizers which will be called in order of appearance, until one of them is capable to vocalize currentSpokenInstruction
Declaration
Swift
open class MultiplexedSpeechSynthesizer : SpeechSynthesizing
extension MultiplexedSpeechSynthesizer: SpeechSynthesizingDelegate
-
A error type returned when encountering errors in the speech engine.
See moreDeclaration
Swift
public enum SpeechError : LocalizedError
-
Declaration
Swift
public enum SpeechFailureAction : String
-
Customization options for the turn-by-turn navigation user experience in a
NavigationViewController
.A navigation options object is where you place customized components that the navigation view controller uses during its lifetime, such as styles or voice controllers. You would likely use this class if you need to specify a Mapbox access token programmatically instead of in the Info.plist file.
Note
NavigationOptions
is designed to be used with theNavigationViewController
class to customize the user experience. To specify criteria when calculating routes, use theNavigationRouteOptions
class. To modify user preferences that persist across navigation sessions, use theNavigationSettings
class.Declaration
Swift
open class NavigationOptions : NavigationCustomizable
-
A view that represents the root view of the MapboxNavigation drop-in UI.
Components
- InstructionsBannerView
- InformationStackView
- BottomBannerView
- ResumeButton
- WayNameLabel
- FloatingStackView
- NavigationMapView
- SpeedLimitView
See more+--------------------+ | 1 | +--------------------+ | 2 | +---+------------+---+ | 8 | | | +---+ | 6 | | | | | 7 +---+ | | | | | | +------------+ | | 4 || 5 | | +------------+-------+ | 3 | +--------------------+
Declaration
Swift
@IBDesignable open class NavigationView : UIView